const express = require('express')
const { Random } = require('mockjs')
const router = express.Router()

router.get('/one', (req, res) => {
  res.send('one')
})

router.get("/info",(req,res) => {
  var data = {
    message: '请求数据成功',
    code: 200,
    body: {
      headImg: Random.image(),
      job: Random.ctitle(),
    }
  };
  res.send(data)
})
/**
 * @Description 
 * @author 孙畅
 * @date 2020-10-19
 * @param {any} '/list'
 * @param {any}
 * @param {any} res
 * @returns {any}
 */
router.get('/list', function (req, res) {
  var data = {}
  data.status = 200
  data.message = 'success'
  data.list = []
  for (var i = 0; i < 20; i ++) {
    data.list.push({
      id: i,
      name: Random.cname(),
      title: Random.ctitle(),
      logo: Random.image()
    })
  }
  res.send(data)
})

/**
 * @Description 
 * @author 孙畅
 * @date 2020-10-19
 * @param {any} '/list'
 * @param {any}
 * @param {any} res
 * @returns {any}
 */
router.get('/appList', function (req, res) {
  var data = {}
  data.status = 200
  data.message = 'success'
  data.list = []
  for (var i = 0; i < 4; i ++) {
    data.list.push({
      id: i,
      name: Random.cname(),
      title: Random.ctitle(45, 55),
      logo: Random.image()
    })
  }
  res.send(data)
})
/**
 * @Description 流程列表
 * @author 孙畅
 * @date 2020-11-02
 * @param {any} '/flow'
 * @param {any} req
 * @param {any} res
 * @returns {any}
 */
router.get('/flow', function (req, res) {
  var data = {}
  data.status = 200
  data.message = 'success'
  data.list = []
  for (var i = 0; i < 15; i++) {
    data.list.push({
      oaName: Random.ctitle(),
      promoter: Random.cname(),
      promoteTime: Random.time()
    })
  }
  res.send(data)
})
/**
 * @Description 获取所有的App
 * @author 孙畅
 * @date 2020-11-02
 * @param {any} '/allApps'
 * @param {any} req
 * @param {any} res
 * @returns {any}
 */
router.get('/allApps', function (req, res) {
  var data = {
    status: 200,
    message: 'success',
    list: []
  }
  for (var i = 0; i < 8; i++) {
    data.list.push({
      id: i,
      name: Random.cname(),
      title: Random.ctitle(45, 55),
      logo: Random.image()
    })
  }
  res.send(data)
})
/**
 * @Description 裤子/上衣 今日完成情况
 * @author 孙畅
 * @date 2020-11-02
 */
router.get('/clothComplete', function (req, res) {
  var data = {
    status: 200,
    message: 'success',
    data: {
      trousers: {
        goalPerHour: 30,
        actlPerHour: 30,
        todayCompleteRate: 89,
        todayDiff: -9,
        outputs: [{
          time: '8:30',
          output: 50
        }, {
          time: '9:30',
          output: 69
        }, {
          time: '10:30',
          output: 78
        }, {
          time: '12:00',
          output: 54
        }, {
          time: '13:00',
          output: 62
        }, {
          time: '14:00',
          output: 65
        }, {
          time: '15:00',
          output: 70
        }, {
          time: '16:00',
          output: 90
        }, {
          time: '17:00',
          output: 64
        }]
      },
      cloth: {
        goalPerHour: 30,
        actlPerHour: 30,
        todayCompleteRate: 89,
        todayDiff: -9,
        outputs: [{
          time: '8:30',
          output: 50
        }, {
          time: '9:30',
          output: 69
        }, {
          time: '10:30',
          output: 78
        }, {
          time: '12:00',
          output: 54
        }, {
          time: '13:00',
          output: 62
        }, {
          time: '14:00',
          output: 65
        }, {
          time: '15:00',
          output: 70
        }, {
          time: '16:00',
          output: 90
        }, {
          time: '17:00',
          output: 64
        }]
      }
    }
  }
  res.send(data)
})

module.exports = router